rendernode: Round pixel colors in color matrix drawing
authorBenjamin Otte <otte@redhat.com>
Thu, 28 Mar 2019 22:57:00 +0000 (23:57 +0100)
committerBenjamin Otte <otte@redhat.com>
Fri, 29 Mar 2019 08:56:52 +0000 (09:56 +0100)
Fixes symbolic-icon-translucent-color.ui reftest

gsk/gskrendernodeimpl.c

index 5e7ade0a20a0c450a68017c3623d4ff8f265a55c..271723cd29a843737161b5a2ea8f2318251f26e7 100644 (file)
@@ -3060,10 +3060,10 @@ gsk_color_matrix_node_draw (GskRenderNode *node,
           if (alpha > 0.0)
             {
               alpha = MIN (alpha, 1.0);
-              pixel_data[x] = (((guint32) (alpha * 255)) << 24) |
-                              (((guint32) (CLAMP (graphene_vec4_get_x (&pixel), 0, 1) * alpha * 255)) << 16) |
-                              (((guint32) (CLAMP (graphene_vec4_get_y (&pixel), 0, 1) * alpha * 255)) <<  8) |
-                               ((guint32) (CLAMP (graphene_vec4_get_z (&pixel), 0, 1) * alpha * 255));
+              pixel_data[x] = (((guint32) roundf (alpha * 255)) << 24) |
+                              (((guint32) roundf (CLAMP (graphene_vec4_get_x (&pixel), 0, 1) * alpha * 255)) << 16) |
+                              (((guint32) roundf (CLAMP (graphene_vec4_get_y (&pixel), 0, 1) * alpha * 255)) <<  8) |
+                               ((guint32) roundf (CLAMP (graphene_vec4_get_z (&pixel), 0, 1) * alpha * 255));
             }
           else
             {